<?php

namespace App\Http\Controllers\AjaxRequest;
use Illuminate\Http\Request;
use Illuminate\Http\Response;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use Input;

class ResetPassWController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return Response
     */

    public function index()
    {
         //echo "1234";
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return Response
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  Request  $request
     * @return Response
     */

    public function store(Request $request)
    {
            $ip = '192.168.0.21';
            $port = '8080';
        /*     $username  =     $_SERVER['HTTP_REFERER'];
            $id = explode('?',$username);
            $I_UserName = explode('=', $id[1]);*/
            $username =  Input::get('username_login');
            $password = Input::get('password');
            $url = $ip.":".$port."/test/user/password";
            $userpass ="username=" .$username."&"."password=".$password;

            $ch = curl_init();
            curl_setopt($ch,CURLOPT_URL,$url); /*获取URL的内容*/
            curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
            curl_setopt($ch,CURLOPT_CUSTOMREQUEST,"PUT");
            curl_setopt($ch, CURLOPT_POSTFIELDS,$userpass);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);/*获取的内容不输出*/
            $content = curl_exec($ch);/*输出获取的内容*/
            curl_close($ch);
            echo $content;
      //  return response()->json($arrayName = array('result' => $content));
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return Response
     */
    public function show($id)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return Response
     */
    public function edit($id)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  Request  $request
     * @param  int  $id
     * @return Response
     */
    public function update(Request $request, $id)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *su
     * @param  int  $id
     * @return Response
     */
    public function destroy($id)
    {
        //
    }
}